<%-- 
    Document   : password
    Created on : Apr 29, 2010, 9:23:11 AM
    Author     : Shiag
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="powerpass.PowerPassSQL" %>
        <%@page import="java.sql.*"%>
<style type="text/css">

    a{
        outline: none;
    }

    a:active{
        outline: none;
    }

    #forgotPass{
    text-align:left;
    }

    #forgotPass h2{
        color:fuchsia;
        font-size:110%;
        font-family:arial;
        margin:10px 10px 10px 10px;
        font-weight:bold !important;
    }

    #forgotPass h2 span{
        font-size:125%;
        font-weight:normal !important;
    }

    #forgotPass{
        border-width: 5px;
        border-color: #000000;
        position: absolute;
        width: 20%;
        height: 20%;
        top: 50%;
        left:45%;
    }

    #forgotPassContents{
        float:left;
        overflow:hidden !important;
        width:auto;
        height:auto;
    }

    #forgotPassContentsInner{
        width:350px;
    }
            </style>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Your Password</title>
        <link rel="icon" type="image/gif" href="images/plogo.gif" />
        <%@include file="/background.jsp"%>
    </head>
    <body>
<%
ResultSet rs;
PowerPassSQL pp = new PowerPassSQL();
String answer1 = request.getParameter("answer1");
            session.setAttribute("theAnswer1", answer1);
            String answer2 = request.getParameter("answer2");
            session.setAttribute("theAnswer2", answer2);
            //out.print("validate forgot pass test");
            String newSQL = "Select q1answer,q2answer,password from clients where email_address ='" + session.getAttribute("theName") + "';";
            rs = pp.selectInfo(newSQL);
            rs.next();
            if (rs.getString(1).toLowerCase().equals(answer1.toLowerCase()))
            {
                if (rs.getString(2).toLowerCase().equals(answer2.toLowerCase()))
                {
                    %>
                    <div id="forgotPass">
                        <div id="forgotPassContent">
                            <div id ="forgotPassContentInner">
                                <form action="login.jsp">
                                <table>
                                    <tr>
                                        <td>Your Password is:</td>
                                        <td>
<%
                        out.println(rs.getString(3));
                        %>
                                
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><input type="Submit" name="submit" id="" value="Back to Login"></td>
                                    </tr>
                                </table>
                                </form>
                            </div>
                        </div>
                    </div>
<%
                }
            }
                        //String to = name;
                        //String from = "mailer@powerpass.com";
                        //String subject = "Your password for your PowerPass account";
                        //String message = "Hello " + name + ",\n your password is: " + foundPass;
    %>
    <%--<jsp:useBean id="mailer" class="com.mailerbean.bean.webapp">
                <jsp:setProperty name="mailer" property="to" value="<%=to%>"/>
                <jsp:setProperty name="mailer" property="from" value="<%=from%>"/>
                <jsp:setProperty name="mailer" property="subject" value="<%=subject%>"/>
                <jsp:setProperty name="mailer" property="message" value="<%=message%>"/>
		<% mailer.sendMail(); %>
	</jsp:useBean>--%>
        <%
                        //out.print("Email has been sent successfully.");
        %>
    </body>
</html>
